﻿using Microsoft.EntityFrameworkCore;
using QuartzServices.Domain.DomainModels;
using QuartzServices.Infrastructure.Mappings;

namespace QuartzServices.Infrastructure
{
    public class MainDBContext:DbContext
    {
        public MainDBContext(DbContextOptions<MainDBContext> options) : base(options)
        { }

        public DbSet<BlcSapLocationModel> BlcSapLocations { get; set; }

        public DbSet<JabilApiTokenModel>  JabilApiTokens { get; set; }

        public DbSet<WeixinOfficialAccountModel> WeixinOfficialAccounts { get; set; }

        public DbSet<SerilogModel> Serilogs { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder) 
        {
            modelBuilder.ApplyConfiguration(new BlcSapLocationMap());

            modelBuilder.ApplyConfiguration(new JabilApiTokenMap());

            modelBuilder.ApplyConfiguration(new WeixinOfficialAccountMap());
            
            modelBuilder.ApplyConfiguration(new SerilogMap());

            base.OnModelCreating(modelBuilder);
        }
    }
}
